package com.gsn.poker.play;

import java.util.List;

import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.gsn.desktop.engine.ActorUtility;
import com.gsn.engine.myplay.GsnGame;

public class CountDownGroup extends Group {
	public static Group convertNum(Integer time, List<AtlasRegion> numsCong) {		
		Group group = new Group();
		group.transform = GsnGame.transform;
		group.height = numsCong.get(0).getRegionHeight();
		String str = ActorUtility.formatNumber(Math.abs(time));
		if (time < 10)
			str = "0" + str;
		int tmpX = 0;
		for (int i = 0; i < str.length(); i++){
			Image img = new Image(numsCong.get(str.charAt(i) - '0'));
			img.x = tmpX;
			tmpX += img.width;
			group.addActor(img);
		}
		group.width = tmpX;
		
		return group;
	}	
}
